import type * as T from './type'
import http from '@/utils/http'

export type * from './type'

/**
 * 消息列表
 * @param query
 */
export function listMessage(query: T.MessagePageQuery) {
  return http.post<T.MessageResp[]>(`/system/message/list`, query)
}

/**
 * 消息分页
 * @param query
 */
export function pageMessage(query: T.MessagePageQuery) {
  return http.post<PageRes<T.MessageResp[]>>(`/system/message/page`, query)
}

/**
 * 未读消息数量
 */
export function getUnreadMessageCount() {
  return http.get(`/system/message/unread/count`)
}

/**
 * 未读消息
 */
export function getUnreadMessage() {
  return http.get(`/system/message/unread`)
}

/**
 * 标记已读
 * @param noticeIds
 */
export function readMessage(noticeIds: string | Array<string | number>) {
  return http.put(`/system/message/read/${noticeIds}`)
}

/**
 * 全部已读
 */
export function readAllMessage() {
  return http.put(`/system/message/read/all`)
}
